package com.kitty.game.pet.handler.upgrade;

import com.kitty.common.utils.SpringUtils;
import com.kitty.game.pet.service.UpgradePetType;

import java.util.HashMap;
import java.util.Map;

public enum UpgradePetHelper {
    INSTANCE;

    private static final Map<String, UpgradePetHandler> handlers = new HashMap<>();

    public void init(String type, UpgradePetHandler upgradeHandler) {
        handlers.put(type, upgradeHandler);
    }

    public UpgradePetHandler getHandler(String type) {
        return handlers.get(type);
    }

    static {
        /**开启点化*/
        INSTANCE.init(UpgradePetType.OPEN_ENCHANT.getType(), SpringUtils.getBean(OpenEnchantPetHandler.class));
        /**点化*/
        INSTANCE.init(UpgradePetType.ENCHANT.getType(), SpringUtils.getBean(EnchantPetHandler.class));
        /**羽化*/
        INSTANCE.init(UpgradePetType.ECLOSION.getType(), SpringUtils.getBean(EclosionPetHandler.class));
        /**开启羽化*/
        INSTANCE.init(UpgradePetType.OPEN_ECLOSION.getType(), SpringUtils.getBean(OpenEclosionPetHandler.class));
        /**宠物幻化*/
        INSTANCE.init(UpgradePetType.PET_MORPH.getType(), SpringUtils.getBean(PetMorphHandler.class));
        /**宠物顿悟*/
        INSTANCE.init(UpgradePetType.INSIGHT.getType(),SpringUtils.getBean(PetInsightHandler.class));
        /**宠物继承*/
        INSTANCE.init(UpgradePetType.extend.getType(),SpringUtils.getBean(PetExtendHandler.class));
        /**宠物遗忘技能*/
        INSTANCE.init(UpgradePetType.forget.getType(),SpringUtils.getBean(PetForgetHandler.class));
        /** 时装 **/
        INSTANCE.init(UpgradePetType.PET_FASION.getType(),SpringUtils.getBean(PetFashionHandler.class));
    }
}
